/*
 * maz_drv_uart.h
 *
 *  Created on: 2020年6月9日
 *      Author: Paul
 */

#ifndef INC_MAZ_DRV_UART_H_
#define INC_MAZ_DRV_UART_H_

#include "maz_drv.h"

typedef enum _MAZDRV_E_UART_
{
    MAZDRV_E_USART1 = 0,
    MAZDRV_E_USART2,
    MAZDRV_E_USART6,
    MAZDRV_E_UART_MAX,
} MAZDRV_E_UART;

typedef enum _MAZDRV_E_UART_IOMAP_
{
    MAZDRV_E_USART1_IOMAP1_PA9_PA10 = 0,        /* USART1 */
    MAZDRV_E_USART1_IOMAP2_PB6_PB7,
    MAZDRV_E_USART2_IOMAP1_PA2_PA3,             /* USART2 */
    MAZDRV_E_USART6_IOMAP1_PA11_PA12,           /* USART6 */
} MAZDRV_E_UART_IOMAP;

typedef enum _MAZDRV_E_UART_USE_
{
    MAZDRV_E_UART_USE_DISABLE = 0,
    MAZDRV_E_UART_USE_ENABLE,
} MAZDRV_E_UART_USE;

typedef struct _MAZDRV_UART_CFG_
{
    uint8_t prior;                              // 中断优先级
    MAZDRV_E_UART_IOMAP iomap;                  // 引脚映射
    UART_HandleTypeDef conf;                    // 串口配置
} MAZDRV_UART_CFG;

typedef struct _MAZDRV_UART_PRIV_
{
    uint32_t reserve[4];
} MAZDRV_UART_PRIV;

typedef struct _MAZDRV_UART_CTRL_
{
    MAZDRV_E_UART_USE use;                      // 是否启用
    MAZDRV_UART_CFG cfg;
    MAZDRV_UART_PRIV priv;
} MAZDRV_UART_CTRL;

int MAZ_Drv_uart_init(void);
int __io_putchar(int ch);

#endif /* INC_MAZ_DRV_UART_H_ */

